﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;

namespace ISFProject.Models
{
    public class School
    {

        [Key, ForeignKey("SchoolCupCoordinator")]
        public int SchoolId { get; set; }

        [Required(ErrorMessage = "Please enter a school name")]
        [StringLength(45, MinimumLength = 3, ErrorMessage = "Invalid field length")]
        [Display(Name = "School name*")]
        public String Name { get; set; }

        [Required(ErrorMessage = "Please enter email of representative")]
        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Please enter a valid email address")]
        [Display(Name = "Email of representative*")]
        public String Mail { get; set; }

        [StringLength(45, MinimumLength = 1, ErrorMessage = "Invalid field length")]
        [Display(Name = "Abbreviation")]
        public String Abbreviation { get; set; }
        
        
        public int AddressId { get; set; }//[Required]
        public virtual Address Address { get; set; }

        public int NSSFId { get; set; }//[required]
        public virtual NSSF NSSF { get; set; }

        
        public virtual SchoolCupCoordinator SchoolCupCoordinator { get; set; }

        
        public virtual List<Team> Teams { get; set; }
    }
}